from django.db import models


class Classroom(models.Model):
    c_name = models.CharField(max_length=8, verbose_name='名称')
    c_people = models.DecimalField(max_digits=10, decimal_places=0, verbose_name='人数')
    c_Theory = models.BooleanField(verbose_name='是否为理论教室')
    c_img = models.FileField(upload_to='upload/', verbose_name='图片')

    class Meta():
        verbose_name_plural = '教室信息'

    def __str__(self):
        return "%s" % self.c_name


class Equipment(models.Model):
    e_number = models.DecimalField(max_digits=6, decimal_places=0, verbose_name='序号', default=1)
    e_name = models.CharField(max_length=8, verbose_name='名称')
    e_money = models.DecimalField(max_digits=6, decimal_places=2, verbose_name='金额')
    e_tame = models.DateTimeField(auto_now=True, verbose_name='时间')
    e_img = models.FileField(upload_to='upload/', verbose_name='图片')
    e_Theory = models.BooleanField(verbose_name='是否正常', default=True)
    e_classroom = models.ForeignKey('Classroom', on_delete=models.CASCADE, verbose_name='所在教室', default='')

    class Meta():
        verbose_name_plural = '资产设备'

    def __str__(self):
        return "%s" % self.e_name


class Hygienism(models.Model):
    """
    记录教室清洁
    """
    h_number = models.DecimalField(max_digits=6, decimal_places=0, verbose_name='序号', default=1)
    h_name = models.CharField(max_length=8, verbose_name='清洁人员名称')
    h_c_name = models.CharField(max_length=8, verbose_name='清洁教室名称')
    h_circumstances = models.CharField(max_length=8, verbose_name='卫生情况', default=True)
    h_person = models.CharField(max_length=8, verbose_name='负责人', default='')
    h_tame = models.DateTimeField(auto_now=True, verbose_name='清洁时间')
    h_img = models.FileField(upload_to='upload/', verbose_name='图片')

    class Meta():
        verbose_name_plural = '教室卫生记录'

    def __str__(self):
        return "%s" % self.h_name
# Create your models here.
